package me.zhengjie.modules.hanzi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.modules.hanzi.domain.UserProgress;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;

@Mapper
public interface UserProgressMapper extends BaseMapper<UserProgress> {
    @Select("SELECT up.character, hc.pinyin, up.learn_time as time " +
            "FROM hanzi_user_progress up " +
            "LEFT JOIN hanzi_character hc ON up.character = hc.character " +
            "WHERE up.user_id = #{userId} " +
            "ORDER BY up.learn_time DESC " +
            "LIMIT 10")
    List<Map<String, Object>> getRecentLearned(@Param("userId") Long userId);
} 